package org.nepu.scr.indexrate.converter.drillingrate.jobarticulation;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.jobarticulation.HighAltitude;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class HighAltitudeConverter implements AttributeConverter<HighAltitude, String> {
    @Override
    public String convertToDatabaseColumn(HighAltitude highAltitude) {
        return JSONUtil.toJsonStr(highAltitude);
    }

    @Override
    public HighAltitude convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, HighAltitude.class);
    }
}
